{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 商誉占比\n",
    "\n",
    "- 作者：DGC'Idea\n",
    "- 版本：V0.1   \n",
    "- 更新日期：2018年4月6日\n",
    "\n",
    "----------\n",
    "- 誉是一种无形资产，是企业溢价收购其他公司的时候产生的，溢价多少商誉就是多少。比如B公司值100亿，A公司花了110亿买下，这多出的10亿就会作为“商誉”体现在A公司的资产里面。\n",
    "- 创业板当年各种重组并购，把自己的商誉搞得特别大。然而，多年以后，当初溢价收购的资产没有带来预想的效果，就需要把这部分商誉从资产里减掉，利润也就会受影响。\n",
    "- 选择商誉占比超过百分之30的展示。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": "数据引擎：运行于研究\n个股框架：运行于研究\n"
    }
   ],
   "source": [
    "#导入库\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import time\n",
    "from datetime import timedelta,date\n",
    "\n",
    "# 聚宽数据\n",
    "import jqdatasdk\n",
    "jqdatasdk.auth(\"13695683829\", \"ssk741212\")\n",
    "from jqdatasdk import *\n",
    "\n",
    "\n",
    "#引入自定义库\n",
    "import sys\n",
    "sys.path.append('../PF')\n",
    "from pf_stk import *\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.创业板商誉占比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": "已准备好！"
    }
   ],
   "source": [
    "  \n",
    "#计算商誉占比\n",
    "def pool(index='000902.XSHG',stat_date='2018q1'):\n",
    "    #初选股票池列表\n",
    "    data_list=[]\n",
    "    code_list=[]\n",
    "    #获取沪深所有股票\n",
    "    stocks=get_index_stocks(index)\n",
    "    #股票总数量\n",
    "    n=len(stocks)\n",
    "    #计数器\n",
    "    m=0\n",
    "    for code in stocks:\n",
    "        try:\n",
    "            #计数器累加\n",
    "            m=m+1\n",
    "            #股票名称\n",
    "            stock_name=jqData.security_info(code).display_name       \n",
    "            #转换代码\n",
    "            stock_code=code[0:6]\n",
    "            #IPO日期\n",
    "            ipo_date = jqData.security_info(code).start_date\n",
    "            # 显示进度\n",
    "            print ('\\r筛选：%s %s %s/%s'%(stock_code,stock_name,m,n),end=\"\")\n",
    "            # 去除退市、ST\n",
    "            if is_st(code):\n",
    "                continue\n",
    "            # 只计算创业板\n",
    "            if not is_cyb(code):\n",
    "                continue    \n",
    "            # 商誉数据    \n",
    "            (net_profit,net_assets,good_will,good_will_ratio)=get_stock_goodwill(code,stat_date)\n",
    "            # 判断有无商誉\n",
    "            if not good_will>0:\n",
    "                continue\n",
    "            # 行业    \n",
    "            industry=get_stock_industry(code)\n",
    "            # 拼接列表\n",
    "            data_list.append([stock_name,net_profit,net_assets,good_will,good_will_ratio,industry,ipo_date])\n",
    "            code_list.append(code)\n",
    "        except:\n",
    "            continue\n",
    "    print( '\\r                                 ',end=\"\")\n",
    "    #整理标题头\n",
    "    columns_list=['name','net_profit','net_assets','good_will','good_will_ratio','industry','ipo_date']\n",
    "    #组织数据\n",
    "    df=pd.DataFrame(index=code_list,data=data_list,columns=columns_list)\n",
    "    df=df.sort_values(['good_will_ratio'],ascending=False)\n",
    "    return df\n",
    "\n",
    "print( '\\r已准备好！',end=\"\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 创业板商誉比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "gwcyb=Stk('csv','../Data/','gwcyb')  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": "筛选：603999 读者传媒 3678/3678"
    }
   ],
   "source": [
    "gwcyb.pool.create_form(pool,index='000902.XSHG',stat_date='2019q3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>名称</th>\n      <th>净利润(千万)</th>\n      <th>净资产(亿)</th>\n      <th>商誉(亿)</th>\n      <th>商誉占比(%)</th>\n      <th>所属行业</th>\n      <th>IPO日期</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>300071</th>\n      <td>华谊嘉信</td>\n      <td>-1.0183</td>\n      <td>0.8147</td>\n      <td>3.8066</td>\n      <td>467.2097</td>\n      <td>传媒I</td>\n      <td>2010-04-21</td>\n    </tr>\n    <tr>\n      <th>300268</th>\n      <td>佳沃股份</td>\n      <td>-5.2974</td>\n      <td>8.1362</td>\n      <td>15.0478</td>\n      <td>184.9481</td>\n      <td>农林牧渔I</td>\n      <td>2011-09-27</td>\n    </tr>\n    <tr>\n      <th>300143</th>\n      <td>盈康生命</td>\n      <td>1.7584</td>\n      <td>21.0592</td>\n      <td>18.9419</td>\n      <td>89.9461</td>\n      <td>医药生物I</td>\n      <td>2010-12-09</td>\n    </tr>\n    <tr>\n      <th>300459</th>\n      <td>金科文化</td>\n      <td>19.0531</td>\n      <td>71.3040</td>\n      <td>62.6099</td>\n      <td>87.8070</td>\n      <td>传媒I</td>\n      <td>2015-05-15</td>\n    </tr>\n    <tr>\n      <th>300299</th>\n      <td>富春股份</td>\n      <td>0.3937</td>\n      <td>10.9515</td>\n      <td>9.1052</td>\n      <td>83.1409</td>\n      <td>传媒I</td>\n      <td>2012-03-19</td>\n    </tr>\n    <tr>\n      <th>300010</th>\n      <td>立思辰</td>\n      <td>2.4922</td>\n      <td>34.9759</td>\n      <td>28.8438</td>\n      <td>82.4676</td>\n      <td>计算机I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300344</th>\n      <td>太空智造</td>\n      <td>0.1033</td>\n      <td>5.9985</td>\n      <td>4.6348</td>\n      <td>77.2658</td>\n      <td>计算机I</td>\n      <td>2012-08-01</td>\n    </tr>\n    <tr>\n      <th>300318</th>\n      <td>博晖创新</td>\n      <td>0.3524</td>\n      <td>10.4535</td>\n      <td>7.8659</td>\n      <td>75.2469</td>\n      <td>医药生物I</td>\n      <td>2012-05-23</td>\n    </tr>\n    <tr>\n      <th>300578</th>\n      <td>会畅通讯</td>\n      <td>1.4961</td>\n      <td>10.2092</td>\n      <td>7.6155</td>\n      <td>74.5943</td>\n      <td>通信I</td>\n      <td>2017-01-25</td>\n    </tr>\n    <tr>\n      <th>300465</th>\n      <td>高伟达</td>\n      <td>3.6709</td>\n      <td>12.6694</td>\n      <td>9.1902</td>\n      <td>72.5389</td>\n      <td>计算机I</td>\n      <td>2015-05-28</td>\n    </tr>\n    <tr>\n      <th>300149</th>\n      <td>量子生物</td>\n      <td>3.1441</td>\n      <td>22.4990</td>\n      <td>16.1706</td>\n      <td>71.8724</td>\n      <td>医药生物I</td>\n      <td>2010-12-22</td>\n    </tr>\n    <tr>\n      <th>300278</th>\n      <td>华昌达</td>\n      <td>-17.9544</td>\n      <td>10.3817</td>\n      <td>7.3490</td>\n      <td>70.7883</td>\n      <td>机械设备I</td>\n      <td>2011-12-16</td>\n    </tr>\n    <tr>\n      <th>300379</th>\n      <td>东方通</td>\n      <td>0.3858</td>\n      <td>15.3202</td>\n      <td>10.7705</td>\n      <td>70.3029</td>\n      <td>计算机I</td>\n      <td>2014-01-28</td>\n    </tr>\n    <tr>\n      <th>300109</th>\n      <td>新开源</td>\n      <td>4.4708</td>\n      <td>30.3579</td>\n      <td>21.2827</td>\n      <td>70.1058</td>\n      <td>化工I</td>\n      <td>2010-08-25</td>\n    </tr>\n    <tr>\n      <th>300629</th>\n      <td>新劲刚</td>\n      <td>-0.6037</td>\n      <td>6.6272</td>\n      <td>4.4952</td>\n      <td>67.8305</td>\n      <td>机械设备I</td>\n      <td>2017-03-24</td>\n    </tr>\n    <tr>\n      <th>300338</th>\n      <td>开元股份</td>\n      <td>1.6326</td>\n      <td>21.6174</td>\n      <td>13.9225</td>\n      <td>64.4044</td>\n      <td>传媒I</td>\n      <td>2012-07-26</td>\n    </tr>\n    <tr>\n      <th>300083</th>\n      <td>劲胜智能</td>\n      <td>-9.8125</td>\n      <td>26.7400</td>\n      <td>16.5352</td>\n      <td>61.8371</td>\n      <td>电子I</td>\n      <td>2010-05-20</td>\n    </tr>\n    <tr>\n      <th>300192</th>\n      <td>科斯伍德</td>\n      <td>6.0570</td>\n      <td>9.6819</td>\n      <td>5.9633</td>\n      <td>61.5927</td>\n      <td>传媒I</td>\n      <td>2011-03-22</td>\n    </tr>\n    <tr>\n      <th>300449</th>\n      <td>汉邦高科</td>\n      <td>-0.5280</td>\n      <td>14.2442</td>\n      <td>8.6500</td>\n      <td>60.7266</td>\n      <td>计算机I</td>\n      <td>2015-04-22</td>\n    </tr>\n    <tr>\n      <th>300603</th>\n      <td>立昂技术</td>\n      <td>4.7473</td>\n      <td>23.7638</td>\n      <td>14.1945</td>\n      <td>59.7317</td>\n      <td>通信I</td>\n      <td>2017-01-26</td>\n    </tr>\n    <tr>\n      <th>300467</th>\n      <td>迅游科技</td>\n      <td>2.8234</td>\n      <td>23.9496</td>\n      <td>14.1732</td>\n      <td>59.1793</td>\n      <td>传媒I</td>\n      <td>2015-05-27</td>\n    </tr>\n    <tr>\n      <th>300464</th>\n      <td>星徽精密</td>\n      <td>3.5218</td>\n      <td>17.4893</td>\n      <td>10.1797</td>\n      <td>58.2054</td>\n      <td>机械设备I</td>\n      <td>2015-06-10</td>\n    </tr>\n    <tr>\n      <th>300038</th>\n      <td>数知科技</td>\n      <td>6.9640</td>\n      <td>110.9255</td>\n      <td>63.1425</td>\n      <td>56.9234</td>\n      <td>传媒I</td>\n      <td>2010-01-08</td>\n    </tr>\n    <tr>\n      <th>300145</th>\n      <td>中金环境</td>\n      <td>9.4789</td>\n      <td>52.4930</td>\n      <td>29.3227</td>\n      <td>55.8602</td>\n      <td>机械设备I</td>\n      <td>2010-12-09</td>\n    </tr>\n    <tr>\n      <th>300058</th>\n      <td>蓝色光标</td>\n      <td>17.1269</td>\n      <td>88.2946</td>\n      <td>49.1081</td>\n      <td>55.6184</td>\n      <td>传媒I</td>\n      <td>2010-02-26</td>\n    </tr>\n    <tr>\n      <th>300276</th>\n      <td>三丰智能</td>\n      <td>4.4280</td>\n      <td>37.2600</td>\n      <td>20.7182</td>\n      <td>55.6043</td>\n      <td>机械设备I</td>\n      <td>2011-11-15</td>\n    </tr>\n    <tr>\n      <th>300472</th>\n      <td>新元科技</td>\n      <td>0.6142</td>\n      <td>11.6896</td>\n      <td>6.4609</td>\n      <td>55.2703</td>\n      <td>机械设备I</td>\n      <td>2015-06-11</td>\n    </tr>\n    <tr>\n      <th>300473</th>\n      <td>德尔股份</td>\n      <td>1.5703</td>\n      <td>20.4031</td>\n      <td>11.2039</td>\n      <td>54.9127</td>\n      <td>汽车I</td>\n      <td>2015-06-12</td>\n    </tr>\n    <tr>\n      <th>300339</th>\n      <td>润和软件</td>\n      <td>5.8994</td>\n      <td>47.8329</td>\n      <td>26.1585</td>\n      <td>54.6872</td>\n      <td>计算机I</td>\n      <td>2012-07-18</td>\n    </tr>\n    <tr>\n      <th>300537</th>\n      <td>广信材料</td>\n      <td>2.0302</td>\n      <td>13.3192</td>\n      <td>7.0091</td>\n      <td>52.6236</td>\n      <td>化工I</td>\n      <td>2016-08-30</td>\n    </tr>\n    <tr>\n      <th>300123</th>\n      <td>亚光科技</td>\n      <td>5.5216</td>\n      <td>49.4853</td>\n      <td>26.0074</td>\n      <td>52.5558</td>\n      <td>国防军工I</td>\n      <td>2010-09-28</td>\n    </tr>\n    <tr>\n      <th>300061</th>\n      <td>旗天科技</td>\n      <td>-3.6594</td>\n      <td>23.1032</td>\n      <td>12.1221</td>\n      <td>52.4693</td>\n      <td>传媒I</td>\n      <td>2010-03-19</td>\n    </tr>\n    <tr>\n      <th>300269</th>\n      <td>联建光电</td>\n      <td>-0.2289</td>\n      <td>20.1309</td>\n      <td>10.4814</td>\n      <td>52.0665</td>\n      <td>传媒I</td>\n      <td>2011-10-12</td>\n    </tr>\n    <tr>\n      <th>300510</th>\n      <td>金冠股份</td>\n      <td>0.3473</td>\n      <td>41.8647</td>\n      <td>21.4685</td>\n      <td>51.2806</td>\n      <td>电气设备I</td>\n      <td>2016-05-06</td>\n    </tr>\n    <tr>\n      <th>300051</th>\n      <td>三五互联</td>\n      <td>-0.1683</td>\n      <td>5.9186</td>\n      <td>2.9252</td>\n      <td>49.4238</td>\n      <td>传媒I</td>\n      <td>2010-02-11</td>\n    </tr>\n    <tr>\n      <th>300343</th>\n      <td>联创股份</td>\n      <td>3.5871</td>\n      <td>25.6337</td>\n      <td>12.6463</td>\n      <td>49.3345</td>\n      <td>传媒I</td>\n      <td>2012-08-01</td>\n    </tr>\n    <tr>\n      <th>300148</th>\n      <td>天舟文化</td>\n      <td>4.2859</td>\n      <td>34.2874</td>\n      <td>16.8800</td>\n      <td>49.2309</td>\n      <td>传媒I</td>\n      <td>2010-12-15</td>\n    </tr>\n    <tr>\n      <th>300238</th>\n      <td>冠昊生物</td>\n      <td>0.3331</td>\n      <td>11.5615</td>\n      <td>5.6656</td>\n      <td>49.0045</td>\n      <td>医药生物I</td>\n      <td>2011-07-06</td>\n    </tr>\n    <tr>\n      <th>300359</th>\n      <td>全通教育</td>\n      <td>1.6949</td>\n      <td>14.4152</td>\n      <td>7.0561</td>\n      <td>48.9487</td>\n      <td>传媒I</td>\n      <td>2014-01-21</td>\n    </tr>\n    <tr>\n      <th>300385</th>\n      <td>雪浪环境</td>\n      <td>1.4573</td>\n      <td>13.5045</td>\n      <td>6.5727</td>\n      <td>48.6704</td>\n      <td>机械设备I</td>\n      <td>2014-06-26</td>\n    </tr>\n    <tr>\n      <th>300184</th>\n      <td>力源信息</td>\n      <td>7.2832</td>\n      <td>47.4555</td>\n      <td>23.0960</td>\n      <td>48.6687</td>\n      <td>电子I</td>\n      <td>2011-02-22</td>\n    </tr>\n    <tr>\n      <th>300513</th>\n      <td>恒实科技</td>\n      <td>3.5740</td>\n      <td>24.6338</td>\n      <td>11.9235</td>\n      <td>48.4029</td>\n      <td>通信I</td>\n      <td>2016-05-30</td>\n    </tr>\n    <tr>\n      <th>300097</th>\n      <td>智云股份</td>\n      <td>-2.7637</td>\n      <td>18.5647</td>\n      <td>8.9742</td>\n      <td>48.3401</td>\n      <td>机械设备I</td>\n      <td>2010-07-28</td>\n    </tr>\n    <tr>\n      <th>300427</th>\n      <td>红相股份</td>\n      <td>6.2825</td>\n      <td>22.3685</td>\n      <td>10.7249</td>\n      <td>47.9462</td>\n      <td>电气设备I</td>\n      <td>2015-02-17</td>\n    </tr>\n    <tr>\n      <th>300031</th>\n      <td>宝通科技</td>\n      <td>5.4963</td>\n      <td>25.9110</td>\n      <td>12.4049</td>\n      <td>47.8751</td>\n      <td>传媒I</td>\n      <td>2009-12-25</td>\n    </tr>\n    <tr>\n      <th>300353</th>\n      <td>东土科技</td>\n      <td>-3.3988</td>\n      <td>25.0336</td>\n      <td>11.8317</td>\n      <td>47.2635</td>\n      <td>通信I</td>\n      <td>2012-09-27</td>\n    </tr>\n    <tr>\n      <th>300326</th>\n      <td>凯利泰</td>\n      <td>6.8011</td>\n      <td>26.3545</td>\n      <td>12.4365</td>\n      <td>47.1892</td>\n      <td>医药生物I</td>\n      <td>2012-06-13</td>\n    </tr>\n    <tr>\n      <th>300164</th>\n      <td>通源石油</td>\n      <td>4.7121</td>\n      <td>19.1724</td>\n      <td>8.9739</td>\n      <td>46.8063</td>\n      <td>采掘I</td>\n      <td>2011-01-13</td>\n    </tr>\n    <tr>\n      <th>300182</th>\n      <td>捷成股份</td>\n      <td>9.0765</td>\n      <td>101.2398</td>\n      <td>47.1126</td>\n      <td>46.5356</td>\n      <td>传媒I</td>\n      <td>2011-02-22</td>\n    </tr>\n    <tr>\n      <th>300423</th>\n      <td>鲁亿通</td>\n      <td>15.5353</td>\n      <td>33.0176</td>\n      <td>15.2329</td>\n      <td>46.1356</td>\n      <td>电气设备I</td>\n      <td>2015-02-17</td>\n    </tr>\n  </tbody>\n</table>\n</div>",
      "text/plain": "          名称  净利润(千万)    净资产(亿)    商誉(亿)   商誉占比(%)   所属行业       IPO日期\n300071  华谊嘉信  -1.0183    0.8147   3.8066  467.2097    传媒I  2010-04-21\n300268  佳沃股份  -5.2974    8.1362  15.0478  184.9481  农林牧渔I  2011-09-27\n300143  盈康生命   1.7584   21.0592  18.9419   89.9461  医药生物I  2010-12-09\n300459  金科文化  19.0531   71.3040  62.6099   87.8070    传媒I  2015-05-15\n300299  富春股份   0.3937   10.9515   9.1052   83.1409    传媒I  2012-03-19\n300010   立思辰   2.4922   34.9759  28.8438   82.4676   计算机I  2009-10-30\n300344  太空智造   0.1033    5.9985   4.6348   77.2658   计算机I  2012-08-01\n300318  博晖创新   0.3524   10.4535   7.8659   75.2469  医药生物I  2012-05-23\n300578  会畅通讯   1.4961   10.2092   7.6155   74.5943    通信I  2017-01-25\n300465   高伟达   3.6709   12.6694   9.1902   72.5389   计算机I  2015-05-28\n300149  量子生物   3.1441   22.4990  16.1706   71.8724  医药生物I  2010-12-22\n300278   华昌达 -17.9544   10.3817   7.3490   70.7883  机械设备I  2011-12-16\n300379   东方通   0.3858   15.3202  10.7705   70.3029   计算机I  2014-01-28\n300109   新开源   4.4708   30.3579  21.2827   70.1058    化工I  2010-08-25\n300629   新劲刚  -0.6037    6.6272   4.4952   67.8305  机械设备I  2017-03-24\n300338  开元股份   1.6326   21.6174  13.9225   64.4044    传媒I  2012-07-26\n300083  劲胜智能  -9.8125   26.7400  16.5352   61.8371    电子I  2010-05-20\n300192  科斯伍德   6.0570    9.6819   5.9633   61.5927    传媒I  2011-03-22\n300449  汉邦高科  -0.5280   14.2442   8.6500   60.7266   计算机I  2015-04-22\n300603  立昂技术   4.7473   23.7638  14.1945   59.7317    通信I  2017-01-26\n300467  迅游科技   2.8234   23.9496  14.1732   59.1793    传媒I  2015-05-27\n300464  星徽精密   3.5218   17.4893  10.1797   58.2054  机械设备I  2015-06-10\n300038  数知科技   6.9640  110.9255  63.1425   56.9234    传媒I  2010-01-08\n300145  中金环境   9.4789   52.4930  29.3227   55.8602  机械设备I  2010-12-09\n300058  蓝色光标  17.1269   88.2946  49.1081   55.6184    传媒I  2010-02-26\n300276  三丰智能   4.4280   37.2600  20.7182   55.6043  机械设备I  2011-11-15\n300472  新元科技   0.6142   11.6896   6.4609   55.2703  机械设备I  2015-06-11\n300473  德尔股份   1.5703   20.4031  11.2039   54.9127    汽车I  2015-06-12\n300339  润和软件   5.8994   47.8329  26.1585   54.6872   计算机I  2012-07-18\n300537  广信材料   2.0302   13.3192   7.0091   52.6236    化工I  2016-08-30\n300123  亚光科技   5.5216   49.4853  26.0074   52.5558  国防军工I  2010-09-28\n300061  旗天科技  -3.6594   23.1032  12.1221   52.4693    传媒I  2010-03-19\n300269  联建光电  -0.2289   20.1309  10.4814   52.0665    传媒I  2011-10-12\n300510  金冠股份   0.3473   41.8647  21.4685   51.2806  电气设备I  2016-05-06\n300051  三五互联  -0.1683    5.9186   2.9252   49.4238    传媒I  2010-02-11\n300343  联创股份   3.5871   25.6337  12.6463   49.3345    传媒I  2012-08-01\n300148  天舟文化   4.2859   34.2874  16.8800   49.2309    传媒I  2010-12-15\n300238  冠昊生物   0.3331   11.5615   5.6656   49.0045  医药生物I  2011-07-06\n300359  全通教育   1.6949   14.4152   7.0561   48.9487    传媒I  2014-01-21\n300385  雪浪环境   1.4573   13.5045   6.5727   48.6704  机械设备I  2014-06-26\n300184  力源信息   7.2832   47.4555  23.0960   48.6687    电子I  2011-02-22\n300513  恒实科技   3.5740   24.6338  11.9235   48.4029    通信I  2016-05-30\n300097  智云股份  -2.7637   18.5647   8.9742   48.3401  机械设备I  2010-07-28\n300427  红相股份   6.2825   22.3685  10.7249   47.9462  电气设备I  2015-02-17\n300031  宝通科技   5.4963   25.9110  12.4049   47.8751    传媒I  2009-12-25\n300353  东土科技  -3.3988   25.0336  11.8317   47.2635    通信I  2012-09-27\n300326   凯利泰   6.8011   26.3545  12.4365   47.1892  医药生物I  2012-06-13\n300164  通源石油   4.7121   19.1724   8.9739   46.8063    采掘I  2011-01-13\n300182  捷成股份   9.0765  101.2398  47.1126   46.5356    传媒I  2011-02-22\n300423   鲁亿通  15.5353   33.0176  15.2329   46.1356  电气设备I  2015-02-17"
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gwcyb.pool.show()[:50]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 沪深300商誉比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "gw300=Stk('csv','../Data/','gw300') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": "筛选：603993 洛阳钼业 300/300"
    }
   ],
   "source": [
    "gw300.pool.create_form(pool,index='000300.XSHG',stat_date='2019q3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>名称</th>\n      <th>净利润(千万)</th>\n      <th>净资产(亿)</th>\n      <th>商誉(亿)</th>\n      <th>商誉占比(%)</th>\n      <th>所属行业</th>\n      <th>IPO日期</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>300015</th>\n      <td>爱尔眼科</td>\n      <td>57.4033</td>\n      <td>68.0615</td>\n      <td>24.4218</td>\n      <td>35.8820</td>\n      <td>医药生物I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300003</th>\n      <td>乐普医疗</td>\n      <td>45.7259</td>\n      <td>78.8815</td>\n      <td>25.8329</td>\n      <td>32.7490</td>\n      <td>医药生物I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300347</th>\n      <td>泰格医药</td>\n      <td>19.8991</td>\n      <td>49.9914</td>\n      <td>11.0071</td>\n      <td>22.0181</td>\n      <td>医药生物I</td>\n      <td>2012-08-17</td>\n    </tr>\n    <tr>\n      <th>300124</th>\n      <td>汇川技术</td>\n      <td>28.1662</td>\n      <td>74.7150</td>\n      <td>11.5414</td>\n      <td>15.4472</td>\n      <td>电气设备I</td>\n      <td>2010-09-28</td>\n    </tr>\n    <tr>\n      <th>300059</th>\n      <td>东方财富</td>\n      <td>52.3751</td>\n      <td>207.7701</td>\n      <td>29.5395</td>\n      <td>14.2174</td>\n      <td>传媒I</td>\n      <td>2010-03-19</td>\n    </tr>\n    <tr>\n      <th>300136</th>\n      <td>信维通信</td>\n      <td>46.0618</td>\n      <td>45.5020</td>\n      <td>5.4547</td>\n      <td>11.9877</td>\n      <td>电子I</td>\n      <td>2010-11-05</td>\n    </tr>\n    <tr>\n      <th>300017</th>\n      <td>网宿科技</td>\n      <td>-3.1146</td>\n      <td>93.9897</td>\n      <td>6.1267</td>\n      <td>6.5185</td>\n      <td>通信I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300070</th>\n      <td>碧水源</td>\n      <td>34.6171</td>\n      <td>219.9132</td>\n      <td>8.0645</td>\n      <td>3.6671</td>\n      <td>公用事业I</td>\n      <td>2010-04-21</td>\n    </tr>\n    <tr>\n      <th>300408</th>\n      <td>三环集团</td>\n      <td>19.9358</td>\n      <td>73.0135</td>\n      <td>2.5179</td>\n      <td>3.4485</td>\n      <td>电子I</td>\n      <td>2014-12-03</td>\n    </tr>\n    <tr>\n      <th>300142</th>\n      <td>沃森生物</td>\n      <td>5.0603</td>\n      <td>56.1097</td>\n      <td>0.3366</td>\n      <td>0.5999</td>\n      <td>医药生物I</td>\n      <td>2010-11-12</td>\n    </tr>\n    <tr>\n      <th>300144</th>\n      <td>宋城演艺</td>\n      <td>48.8868</td>\n      <td>101.9782</td>\n      <td>0.4550</td>\n      <td>0.4462</td>\n      <td>休闲服务I</td>\n      <td>2010-12-09</td>\n    </tr>\n    <tr>\n      <th>300498</th>\n      <td>温氏股份</td>\n      <td>488.9094</td>\n      <td>382.1207</td>\n      <td>1.5313</td>\n      <td>0.4007</td>\n      <td>农林牧渔I</td>\n      <td>2015-11-02</td>\n    </tr>\n    <tr>\n      <th>300122</th>\n      <td>智飞生物</td>\n      <td>61.5971</td>\n      <td>51.4384</td>\n      <td>0.1928</td>\n      <td>0.3748</td>\n      <td>医药生物I</td>\n      <td>2010-09-28</td>\n    </tr>\n    <tr>\n      <th>300033</th>\n      <td>同花顺</td>\n      <td>19.3793</td>\n      <td>35.5324</td>\n      <td>0.0390</td>\n      <td>0.1096</td>\n      <td>计算机I</td>\n      <td>2009-12-25</td>\n    </tr>\n  </tbody>\n</table>\n</div>",
      "text/plain": "          名称   净利润(千万)    净资产(亿)    商誉(亿)  商誉占比(%)   所属行业       IPO日期\n300015  爱尔眼科   57.4033   68.0615  24.4218  35.8820  医药生物I  2009-10-30\n300003  乐普医疗   45.7259   78.8815  25.8329  32.7490  医药生物I  2009-10-30\n300347  泰格医药   19.8991   49.9914  11.0071  22.0181  医药生物I  2012-08-17\n300124  汇川技术   28.1662   74.7150  11.5414  15.4472  电气设备I  2010-09-28\n300059  东方财富   52.3751  207.7701  29.5395  14.2174    传媒I  2010-03-19\n300136  信维通信   46.0618   45.5020   5.4547  11.9877    电子I  2010-11-05\n300017  网宿科技   -3.1146   93.9897   6.1267   6.5185    通信I  2009-10-30\n300070   碧水源   34.6171  219.9132   8.0645   3.6671  公用事业I  2010-04-21\n300408  三环集团   19.9358   73.0135   2.5179   3.4485    电子I  2014-12-03\n300142  沃森生物    5.0603   56.1097   0.3366   0.5999  医药生物I  2010-11-12\n300144  宋城演艺   48.8868  101.9782   0.4550   0.4462  休闲服务I  2010-12-09\n300498  温氏股份  488.9094  382.1207   1.5313   0.4007  农林牧渔I  2015-11-02\n300122  智飞生物   61.5971   51.4384   0.1928   0.3748  医药生物I  2010-09-28\n300033   同花顺   19.3793   35.5324   0.0390   0.1096   计算机I  2009-12-25"
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gw300.pool.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 沪深500商誉比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "gw500=Stk('csv','../Data/','gw500')  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": "筛选：603983 丸美股份 500/500"
    }
   ],
   "source": [
    "gw500.pool.create_form(pool,index='000905.XSHG',stat_date='2018q3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>名称</th>\n      <th>净利润(千万)</th>\n      <th>净资产(亿)</th>\n      <th>商誉(亿)</th>\n      <th>商誉占比(%)</th>\n      <th>所属行业</th>\n      <th>IPO日期</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>300459</th>\n      <td>金科文化</td>\n      <td>20.3480</td>\n      <td>68.2295</td>\n      <td>63.7668</td>\n      <td>93.4592</td>\n      <td>传媒I</td>\n      <td>2015-05-15</td>\n    </tr>\n    <tr>\n      <th>300010</th>\n      <td>立思辰</td>\n      <td>7.5686</td>\n      <td>56.4413</td>\n      <td>41.5600</td>\n      <td>73.6339</td>\n      <td>计算机I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300058</th>\n      <td>蓝色光标</td>\n      <td>10.6055</td>\n      <td>65.2642</td>\n      <td>47.1449</td>\n      <td>72.2370</td>\n      <td>传媒I</td>\n      <td>2010-02-26</td>\n    </tr>\n    <tr>\n      <th>300315</th>\n      <td>掌趣科技</td>\n      <td>14.2160</td>\n      <td>91.0355</td>\n      <td>53.9180</td>\n      <td>59.2274</td>\n      <td>传媒I</td>\n      <td>2012-05-11</td>\n    </tr>\n    <tr>\n      <th>300244</th>\n      <td>迪安诊断</td>\n      <td>15.1373</td>\n      <td>36.2932</td>\n      <td>19.4326</td>\n      <td>53.5432</td>\n      <td>医药生物I</td>\n      <td>2011-07-19</td>\n    </tr>\n    <tr>\n      <th>300182</th>\n      <td>捷成股份</td>\n      <td>22.1470</td>\n      <td>105.0602</td>\n      <td>55.4743</td>\n      <td>52.8024</td>\n      <td>传媒I</td>\n      <td>2011-02-22</td>\n    </tr>\n    <tr>\n      <th>300285</th>\n      <td>国瓷材料</td>\n      <td>12.0025</td>\n      <td>33.3559</td>\n      <td>15.2352</td>\n      <td>45.6746</td>\n      <td>化工I</td>\n      <td>2012-01-13</td>\n    </tr>\n    <tr>\n      <th>300159</th>\n      <td>新研股份</td>\n      <td>13.4936</td>\n      <td>66.0827</td>\n      <td>28.8640</td>\n      <td>43.6787</td>\n      <td>国防军工I</td>\n      <td>2011-01-07</td>\n    </tr>\n    <tr>\n      <th>300002</th>\n      <td>神州泰岳</td>\n      <td>-2.1748</td>\n      <td>49.7972</td>\n      <td>20.6262</td>\n      <td>41.4203</td>\n      <td>计算机I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300308</th>\n      <td>中际旭创</td>\n      <td>16.4570</td>\n      <td>45.3781</td>\n      <td>17.1676</td>\n      <td>37.8324</td>\n      <td>通信I</td>\n      <td>2012-04-10</td>\n    </tr>\n    <tr>\n      <th>300324</th>\n      <td>旋极信息</td>\n      <td>11.0956</td>\n      <td>53.2143</td>\n      <td>19.4198</td>\n      <td>36.4936</td>\n      <td>计算机I</td>\n      <td>2012-06-08</td>\n    </tr>\n    <tr>\n      <th>300383</th>\n      <td>光环新网</td>\n      <td>18.3050</td>\n      <td>67.4835</td>\n      <td>23.9790</td>\n      <td>35.5332</td>\n      <td>通信I</td>\n      <td>2014-01-29</td>\n    </tr>\n    <tr>\n      <th>300296</th>\n      <td>利亚德</td>\n      <td>36.0032</td>\n      <td>76.1444</td>\n      <td>26.8937</td>\n      <td>35.3194</td>\n      <td>电子I</td>\n      <td>2012-03-15</td>\n    </tr>\n    <tr>\n      <th>300180</th>\n      <td>华峰超纤</td>\n      <td>7.2412</td>\n      <td>51.1627</td>\n      <td>17.3315</td>\n      <td>33.8753</td>\n      <td>化工I</td>\n      <td>2011-02-22</td>\n    </tr>\n    <tr>\n      <th>300113</th>\n      <td>顺网科技</td>\n      <td>20.7147</td>\n      <td>34.1271</td>\n      <td>10.9929</td>\n      <td>32.2116</td>\n      <td>传媒I</td>\n      <td>2010-08-27</td>\n    </tr>\n    <tr>\n      <th>300297</th>\n      <td>蓝盾股份</td>\n      <td>8.0893</td>\n      <td>43.9513</td>\n      <td>13.0271</td>\n      <td>29.6399</td>\n      <td>计算机I</td>\n      <td>2012-03-15</td>\n    </tr>\n    <tr>\n      <th>300009</th>\n      <td>安科生物</td>\n      <td>10.2272</td>\n      <td>19.8435</td>\n      <td>5.6316</td>\n      <td>28.3799</td>\n      <td>医药生物I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300168</th>\n      <td>万达信息</td>\n      <td>7.0704</td>\n      <td>35.5759</td>\n      <td>10.0507</td>\n      <td>28.2515</td>\n      <td>计算机I</td>\n      <td>2011-01-25</td>\n    </tr>\n    <tr>\n      <th>300027</th>\n      <td>华谊兄弟</td>\n      <td>6.4464</td>\n      <td>110.4193</td>\n      <td>30.5968</td>\n      <td>27.7097</td>\n      <td>传媒I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300418</th>\n      <td>昆仑万维</td>\n      <td>29.6881</td>\n      <td>59.4019</td>\n      <td>15.3488</td>\n      <td>25.8389</td>\n      <td>传媒I</td>\n      <td>2015-01-21</td>\n    </tr>\n    <tr>\n      <th>300199</th>\n      <td>翰宇药业</td>\n      <td>8.3767</td>\n      <td>40.1714</td>\n      <td>8.7240</td>\n      <td>21.7170</td>\n      <td>医药生物I</td>\n      <td>2011-04-07</td>\n    </tr>\n    <tr>\n      <th>300166</th>\n      <td>东方国信</td>\n      <td>7.9176</td>\n      <td>47.2679</td>\n      <td>10.0444</td>\n      <td>21.2500</td>\n      <td>计算机I</td>\n      <td>2011-01-25</td>\n    </tr>\n    <tr>\n      <th>300133</th>\n      <td>华策影视</td>\n      <td>10.3670</td>\n      <td>72.2072</td>\n      <td>13.2941</td>\n      <td>18.4110</td>\n      <td>传媒I</td>\n      <td>2010-10-26</td>\n    </tr>\n    <tr>\n      <th>300026</th>\n      <td>红日药业</td>\n      <td>12.2637</td>\n      <td>69.2816</td>\n      <td>11.7711</td>\n      <td>16.9902</td>\n      <td>医药生物I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300253</th>\n      <td>卫宁健康</td>\n      <td>6.9478</td>\n      <td>30.9557</td>\n      <td>4.7490</td>\n      <td>15.3412</td>\n      <td>计算机I</td>\n      <td>2011-08-18</td>\n    </tr>\n    <tr>\n      <th>300197</th>\n      <td>铁汉生态</td>\n      <td>-2.3653</td>\n      <td>69.0482</td>\n      <td>9.1898</td>\n      <td>13.3092</td>\n      <td>建筑装饰I</td>\n      <td>2011-03-29</td>\n    </tr>\n    <tr>\n      <th>300115</th>\n      <td>长盈精密</td>\n      <td>8.5496</td>\n      <td>47.1754</td>\n      <td>3.9277</td>\n      <td>8.3257</td>\n      <td>电子I</td>\n      <td>2010-09-02</td>\n    </tr>\n    <tr>\n      <th>300257</th>\n      <td>开山股份</td>\n      <td>3.6548</td>\n      <td>34.5978</td>\n      <td>2.5608</td>\n      <td>7.4016</td>\n      <td>机械设备I</td>\n      <td>2011-08-19</td>\n    </tr>\n    <tr>\n      <th>300012</th>\n      <td>华测检测</td>\n      <td>11.4327</td>\n      <td>26.6780</td>\n      <td>1.7449</td>\n      <td>6.5408</td>\n      <td>综合I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300088</th>\n      <td>长信科技</td>\n      <td>24.8970</td>\n      <td>47.9509</td>\n      <td>2.7406</td>\n      <td>5.7154</td>\n      <td>电子I</td>\n      <td>2010-05-26</td>\n    </tr>\n    <tr>\n      <th>300001</th>\n      <td>特锐德</td>\n      <td>1.7655</td>\n      <td>34.1718</td>\n      <td>1.8673</td>\n      <td>5.4645</td>\n      <td>电气设备I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300251</th>\n      <td>光线传媒</td>\n      <td>17.8371</td>\n      <td>97.5940</td>\n      <td>2.4106</td>\n      <td>2.4700</td>\n      <td>传媒I</td>\n      <td>2011-08-03</td>\n    </tr>\n    <tr>\n      <th>300014</th>\n      <td>亿纬锂能</td>\n      <td>22.0726</td>\n      <td>35.4228</td>\n      <td>0.6580</td>\n      <td>1.8575</td>\n      <td>电子I</td>\n      <td>2009-10-30</td>\n    </tr>\n    <tr>\n      <th>300207</th>\n      <td>欣旺达</td>\n      <td>21.0259</td>\n      <td>50.7504</td>\n      <td>0.7073</td>\n      <td>1.3937</td>\n      <td>电子I</td>\n      <td>2011-04-21</td>\n    </tr>\n    <tr>\n      <th>300072</th>\n      <td>三聚环保</td>\n      <td>2.6911</td>\n      <td>116.6006</td>\n      <td>1.3526</td>\n      <td>1.1600</td>\n      <td>化工I</td>\n      <td>2010-04-27</td>\n    </tr>\n    <tr>\n      <th>300529</th>\n      <td>健帆生物</td>\n      <td>9.5824</td>\n      <td>15.9693</td>\n      <td>0.1772</td>\n      <td>1.1095</td>\n      <td>医药生物I</td>\n      <td>2016-08-02</td>\n    </tr>\n    <tr>\n      <th>300376</th>\n      <td>易事特</td>\n      <td>19.1250</td>\n      <td>48.9136</td>\n      <td>0.4715</td>\n      <td>0.9639</td>\n      <td>电气设备I</td>\n      <td>2014-01-27</td>\n    </tr>\n    <tr>\n      <th>300134</th>\n      <td>大富科技</td>\n      <td>-5.1413</td>\n      <td>52.7633</td>\n      <td>0.3189</td>\n      <td>0.6044</td>\n      <td>通信I</td>\n      <td>2010-10-26</td>\n    </tr>\n  </tbody>\n</table>\n</div>",
      "text/plain": "          名称  净利润(千万)    净资产(亿)    商誉(亿)  商誉占比(%)   所属行业       IPO日期\n300459  金科文化  20.3480   68.2295  63.7668  93.4592    传媒I  2015-05-15\n300010   立思辰   7.5686   56.4413  41.5600  73.6339   计算机I  2009-10-30\n300058  蓝色光标  10.6055   65.2642  47.1449  72.2370    传媒I  2010-02-26\n300315  掌趣科技  14.2160   91.0355  53.9180  59.2274    传媒I  2012-05-11\n300244  迪安诊断  15.1373   36.2932  19.4326  53.5432  医药生物I  2011-07-19\n300182  捷成股份  22.1470  105.0602  55.4743  52.8024    传媒I  2011-02-22\n300285  国瓷材料  12.0025   33.3559  15.2352  45.6746    化工I  2012-01-13\n300159  新研股份  13.4936   66.0827  28.8640  43.6787  国防军工I  2011-01-07\n300002  神州泰岳  -2.1748   49.7972  20.6262  41.4203   计算机I  2009-10-30\n300308  中际旭创  16.4570   45.3781  17.1676  37.8324    通信I  2012-04-10\n300324  旋极信息  11.0956   53.2143  19.4198  36.4936   计算机I  2012-06-08\n300383  光环新网  18.3050   67.4835  23.9790  35.5332    通信I  2014-01-29\n300296   利亚德  36.0032   76.1444  26.8937  35.3194    电子I  2012-03-15\n300180  华峰超纤   7.2412   51.1627  17.3315  33.8753    化工I  2011-02-22\n300113  顺网科技  20.7147   34.1271  10.9929  32.2116    传媒I  2010-08-27\n300297  蓝盾股份   8.0893   43.9513  13.0271  29.6399   计算机I  2012-03-15\n300009  安科生物  10.2272   19.8435   5.6316  28.3799  医药生物I  2009-10-30\n300168  万达信息   7.0704   35.5759  10.0507  28.2515   计算机I  2011-01-25\n300027  华谊兄弟   6.4464  110.4193  30.5968  27.7097    传媒I  2009-10-30\n300418  昆仑万维  29.6881   59.4019  15.3488  25.8389    传媒I  2015-01-21\n300199  翰宇药业   8.3767   40.1714   8.7240  21.7170  医药生物I  2011-04-07\n300166  东方国信   7.9176   47.2679  10.0444  21.2500   计算机I  2011-01-25\n300133  华策影视  10.3670   72.2072  13.2941  18.4110    传媒I  2010-10-26\n300026  红日药业  12.2637   69.2816  11.7711  16.9902  医药生物I  2009-10-30\n300253  卫宁健康   6.9478   30.9557   4.7490  15.3412   计算机I  2011-08-18\n300197  铁汉生态  -2.3653   69.0482   9.1898  13.3092  建筑装饰I  2011-03-29\n300115  长盈精密   8.5496   47.1754   3.9277   8.3257    电子I  2010-09-02\n300257  开山股份   3.6548   34.5978   2.5608   7.4016  机械设备I  2011-08-19\n300012  华测检测  11.4327   26.6780   1.7449   6.5408    综合I  2009-10-30\n300088  长信科技  24.8970   47.9509   2.7406   5.7154    电子I  2010-05-26\n300001   特锐德   1.7655   34.1718   1.8673   5.4645  电气设备I  2009-10-30\n300251  光线传媒  17.8371   97.5940   2.4106   2.4700    传媒I  2011-08-03\n300014  亿纬锂能  22.0726   35.4228   0.6580   1.8575    电子I  2009-10-30\n300207   欣旺达  21.0259   50.7504   0.7073   1.3937    电子I  2011-04-21\n300072  三聚环保   2.6911  116.6006   1.3526   1.1600    化工I  2010-04-27\n300529  健帆生物   9.5824   15.9693   0.1772   1.1095  医药生物I  2016-08-02\n300376   易事特  19.1250   48.9136   0.4715   0.9639  电气设备I  2014-01-27\n300134  大富科技  -5.1413   52.7633   0.3189   0.6044    通信I  2010-10-26"
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gw500.pool.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 沪深1000商誉比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "gw1000=Stk('csv','../Data/','gw1000')  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": "筛选：603997 继峰股份 1000/1000"
    }
   ],
   "source": [
    "gw1000.pool.create_form(pool,index='000852.XSHG',stat_date='2019q3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>名称</th>\n      <th>净利润(千万)</th>\n      <th>净资产(亿)</th>\n      <th>商誉(亿)</th>\n      <th>商誉占比(%)</th>\n      <th>所属行业</th>\n      <th>IPO日期</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>300143</th>\n      <td>盈康生命</td>\n      <td>1.7584</td>\n      <td>21.0592</td>\n      <td>18.9419</td>\n      <td>89.9461</td>\n      <td>医药生物I</td>\n      <td>2010-12-09</td>\n    </tr>\n    <tr>\n      <th>300299</th>\n      <td>富春股份</td>\n      <td>0.3937</td>\n      <td>10.9515</td>\n      <td>9.1052</td>\n      <td>83.1409</td>\n      <td>传媒I</td>\n      <td>2012-03-19</td>\n    </tr>\n    <tr>\n      <th>300149</th>\n      <td>量子生物</td>\n      <td>3.1441</td>\n      <td>22.4990</td>\n      <td>16.1706</td>\n      <td>71.8724</td>\n      <td>医药生物I</td>\n      <td>2010-12-22</td>\n    </tr>\n    <tr>\n      <th>300278</th>\n      <td>华昌达</td>\n      <td>-17.9544</td>\n      <td>10.3817</td>\n      <td>7.3490</td>\n      <td>70.7883</td>\n      <td>机械设备I</td>\n      <td>2011-12-16</td>\n    </tr>\n    <tr>\n      <th>300379</th>\n      <td>东方通</td>\n      <td>0.3858</td>\n      <td>15.3202</td>\n      <td>10.7705</td>\n      <td>70.3029</td>\n      <td>计算机I</td>\n      <td>2014-01-28</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>300377</th>\n      <td>赢时胜</td>\n      <td>4.4711</td>\n      <td>28.9226</td>\n      <td>0.0150</td>\n      <td>0.0520</td>\n      <td>计算机I</td>\n      <td>2014-01-27</td>\n    </tr>\n    <tr>\n      <th>300458</th>\n      <td>全志科技</td>\n      <td>6.9652</td>\n      <td>22.3204</td>\n      <td>0.0047</td>\n      <td>0.0210</td>\n      <td>电子I</td>\n      <td>2015-05-15</td>\n    </tr>\n    <tr>\n      <th>300723</th>\n      <td>一品红</td>\n      <td>6.0529</td>\n      <td>13.9680</td>\n      <td>0.0026</td>\n      <td>0.0183</td>\n      <td>医药生物I</td>\n      <td>2017-11-16</td>\n    </tr>\n    <tr>\n      <th>300726</th>\n      <td>宏达电子</td>\n      <td>6.3656</td>\n      <td>17.3639</td>\n      <td>0.0009</td>\n      <td>0.0053</td>\n      <td>电子I</td>\n      <td>2017-11-21</td>\n    </tr>\n    <tr>\n      <th>300533</th>\n      <td>冰川网络</td>\n      <td>2.7962</td>\n      <td>16.3921</td>\n      <td>0.0006</td>\n      <td>0.0035</td>\n      <td>传媒I</td>\n      <td>2016-08-18</td>\n    </tr>\n  </tbody>\n</table>\n<p>186 rows × 7 columns</p>\n</div>",
      "text/plain": "          名称  净利润(千万)   净资产(亿)    商誉(亿)  商誉占比(%)   所属行业       IPO日期\n300143  盈康生命   1.7584  21.0592  18.9419  89.9461  医药生物I  2010-12-09\n300299  富春股份   0.3937  10.9515   9.1052  83.1409    传媒I  2012-03-19\n300149  量子生物   3.1441  22.4990  16.1706  71.8724  医药生物I  2010-12-22\n300278   华昌达 -17.9544  10.3817   7.3490  70.7883  机械设备I  2011-12-16\n300379   东方通   0.3858  15.3202  10.7705  70.3029   计算机I  2014-01-28\n...      ...      ...      ...      ...      ...    ...         ...\n300377   赢时胜   4.4711  28.9226   0.0150   0.0520   计算机I  2014-01-27\n300458  全志科技   6.9652  22.3204   0.0047   0.0210    电子I  2015-05-15\n300723   一品红   6.0529  13.9680   0.0026   0.0183  医药生物I  2017-11-16\n300726  宏达电子   6.3656  17.3639   0.0009   0.0053    电子I  2017-11-21\n300533  冰川网络   2.7962  16.3921   0.0006   0.0035    传媒I  2016-08-18\n\n[186 rows x 7 columns]"
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gw1000.pool.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.4 64-bit ('ProgramData': virtualenv)",
   "language": "python",
   "name": "python37464bitprogramdatavirtualenv15933603a28f4019abb268061593605c"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "3.7.4-final"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "MarkDown菜单",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}